package com.smartstate.dataManagement.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.smartstate.dataManagement.entity.RateCalculation;
import com.smartstate.dataManagement.vo.RateCalculationVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>费率</p>
 * <p>@Author 陈永杰</p>
 * <p>@Date: 2022/8/16</p>
 * <p>@Time: 10:38</p>
 * <p>@version 1.0 <p>
 */
@Mapper
public interface RateCalculationMapper extends BaseMapper<RateCalculation> {

    /**
     * 增加费率信息  判断峰值 平值 谷值
     * @param rateCalculation
     * @return
     */
    int addRatecalculation(RateCalculation rateCalculation);

    /**
     * 根据id 修改费率
     * @param rateCalculation
     * @return
     */
    int updateRate(RateCalculation rateCalculation);

    @Select("select * from ratecalculation where effectiveTime <= #{startTime} and medium = #{medium} order by effectiveTime DESC limit 1")
    RateCalculation queryRate(@Param("startTime") String startTime, String medium);

}
